const { version } = require('mongoose')
const mongoose = require('./db')

//登录
const peoSchema = mongoose.Schema({
    user: String,//姓名
    phone:String,//手机号
    email:String,//邮箱
    num:Number,//工号
    jiao:String,//教育程度
    img:String,//照片
},{versionKey:false})

//注册
const peoUser = mongoose.Schema({
    phone:String,
    password:String
},{versionKey:false})

// 验证码存储
const emailSchema = mongoose.Schema({
    phone:String,
    code:String,
    expiresAt:{
        type:Date,
        expires:60*10,
        default:Date.now()
    }
},{versionKey:false})

const userModel = mongoose.model('User',peoSchema,'User')
const peoModel = mongoose.model('users',peoUser,'users')
const emailModel = mongoose.model('email',emailSchema,'email')

const shopSchema = mongoose.Schema({
    name:String,
    points:Number,
    img:String,
    stock:Number,
    time:String,
})
const shopModel = mongoose.model('Shop',shopSchema,'Shop')
module.exports = {

    userModel,
    peoModel,
    emailModel,
    shopModel

}